#include <iostream>
#include <vector>
#include <string>

using namespace std;

void initPre (string& s, vector<int>& p) {
	p.resize(s.length(),0);
	for (int i = 1; i < s.length(); ++i) {
		int j = p[i-1];
		while (j > 0 && s[i] != s[j])
			j = p[j-1];
		if (s[i] == s[j])  ++j;
		p[i] = j;
	}
}

void findString(const string& s, const string& t) {
	string b = s + '\n' + t;
	vector<int> p;
	initPre(b,p);
	for(int i = s.length(); i < b.length(); ++i)
		if (p[i] == s.length())
			cout << i - 2*s.length() <<' ';
	cout<<endl;
}

int main() {
	string s,t;
	getline(cin,t);
	getline(cin,s);
	findString(s,t);
	system("pause");
	return 0;
}